package com.ruoyi.media.echatsData;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.dtflys.forest.Forest;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.helper.LoginHelper;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.media.echatsData.entity.PlatformAccount;
import com.ruoyi.media.echatsData.entity.ResData;
import com.ruoyi.media.mediaAccount.domain.MediaAccount;
import com.ruoyi.media.mediaAccount.domain.bo.MediaAccountBo;
import com.ruoyi.media.mediaAccount.domain.vo.MediaAccountVo;
import com.ruoyi.media.mediaAccount.mapper.MediaAccountMapper;
import com.ruoyi.media.mediaAccount.service.IMediaAccountService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.List;

import static com.ruoyi.media.mediaAccount.domain.bo.MediaAccountBo.SPHXD;

/**
 * 图标数据
 *
 * @author dqw
 * @date 2023-03-23
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/media/chatData")
public class EchatsController extends BaseController {

    private final MediaAccountMapper mediaAccountMapper;

    /**
     * 根据当前登录账号获取账号分布列表
     */
    @GetMapping("/getAllAccountNum")
    public R<List<ResData>> getAllAccountNum() {
        LoginUser  loginUser = LoginHelper.getLoginUser();
        if(loginUser != null){
            return R.ok(mediaAccountMapper.getPlatformAccountCount(loginUser.getUsername()));
        }
        return R.fail("当前登录用户异常！");
    }




}
